<?php

namespace Weapp\Shop;

use Weapp\Basic\Basic;

/**
 * 售后接口
 * Class AfterSale
 * @url https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent2/API/aftersale/add.html
 * @package Weapp/Shop
 */
class AfterSale extends Basic
{
    /**
     * 创建售后
     * @param array $data
     * @return array
     * @throws \Weapp\Exceptions\InvalidResponseException
     * @throws \Weapp\Exceptions\LocalCacheException
     */
    public function add($data)
    {
        $url = 'shop/aftersale/add';
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->callPostApi($url, $data, true);
    }

    /**
     * 获取订单下售后单
     * @param array $data
     * @return array
     * @throws \Weapp\Exceptions\InvalidResponseException
     * @throws \Weapp\Exceptions\LocalCacheException
     */
    public function get($data)
    {
        $url = 'shop/aftersale/get';
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->callPostApi($url, $data, true);
    }

    /**
     * 更新售后
     * @param array $data
     * @return array
     * @throws \Weapp\Exceptions\InvalidResponseException
     * @throws \Weapp\Exceptions\LocalCacheException
     */
    public function update($data)
    {
        $url = 'shop/aftersale/update';
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->callPostApi($url, $data, true);
    }
}
